package com.zqx.controller;

import com.zqx.constant.MessageConstant;
import com.zqx.entity.Result;
import com.zqx.pojo.CheckGroup;
import com.zqx.service.CheckGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author:ZQX
 * @Date:2021/8/29 18:43
 * @Description: 检查组控制层
 */
@Controller
@ResponseBody
@RequestMapping("/checkgroup")
public class CheckGroupController {
    @Autowired
    private CheckGroupService checkGroupService;
    @RequestMapping("/add")
    public Result  add(@RequestBody CheckGroup checkGroup,Integer[] checkitemIds){
        try {
            //给t_checkgroup表添加一条数据
            checkGroupService.add(checkGroup,checkitemIds);
            return new Result(true, MessageConstant.ADD_CHECKGROUP_SUCCESS);
        } catch (Exception e) {
            e.printStackTrace();
            return new  Result(false, MessageConstant.ADD_CHECKGROUP_FAIL);
        }

    }
}
